/*
 * Graph.c
 *
 *  Created on: 05/08/2013
 *      Author: marcio
 */
#include <Graph.h>

void setGraph(Graph* h){
	g = h;
	gedges = h->edges;
	gn = h->n;
	gm = h->m;
}

Graph* getGraph(){
	return g;
}

Graph* homorphism(long *R, long r){
	//TODO
	return NULL;
}

void readGraph(FILE* gfile){
	Graph* g = (Graph*)malloc(sizeof(Graph));
	char code;
	long i, j;
	fscanf(gfile, "%c", &code);
	fscanf(gfile, "%lu", &(g->n));
	fscanf(gfile, "%llu", &(g->m));
	setGraph(g);
	while(!feof(gfile)){
		fscanf(gfile, "%c", &code);
		fscanf(gfile, "%lu", &i);
		fscanf(gfile, "%lu", &j);
		addEdge(i,j);
	}
}

